Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix constructor order, friend class, inconsistent function, inconsistent class/struct #1725

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

yhmtsai
Copy link
Member

@yhmtsai yhmtsai commented Nov 14, 2024

From #1675 , we can not use clang-cl on windows to build ginkgo (maybe only static build, not sure the shared build)
The reason is the inconsistence between the declaration and declaration of definition.
For example,
We declare void func(int *a);, which is seen by ginkgo_core. We also use it to instantiate the function.
However, we implement it like void func(int *const a) {...}.
The symbol in the library from clang-cl will use void func(int *const a) not void func(int *a).
core only know void func(int *a) such that it can not find the symbol properly although the int* a should be fit into int* const a

More than that, I also fix the constructor order is different from the data member order, microsoft does not like the friend class without namespace not in the nearest namespace, and inconsistent class/struct.

also, add some tricks to avoid alais undeclared in the a structure which is in another tempalted structure.
It is mentioned in llvm/llvm-project#64996
we use using .. = .. in the nested struct as workaround here

@yhmtsai yhmtsai added the 1:ST:WIP This PR is a work in progress. Not ready for review. label Nov 14, 2024
@yhmtsai yhmtsai self-assigned this Nov 14, 2024
@ginkgo-bot ginkgo-bot added reg:testing This is related to testing. reg:ci-cd This is related to the continuous integration system. reg:benchmarking This is related to benchmarking. type:solver This is related to the solvers type:preconditioner This is related to the preconditioners type:matrix-format This is related to the Matrix formats type:reordering This is related to the matrix(LinOp) reordering type:multigrid This is related to multigrid type:stopping-criteria This is related to the stopping criteria mod:all This touches all Ginkgo modules. labels Nov 14, 2024
Copy link
Member

@upsj upsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great catch, I would have thought that -Wreorder can catch some of these issues, and I must have missed the name mangling capturing parameter const-ness.

@yhmtsai yhmtsai added the plat:windows This is related to the Windows Operating system label Nov 14, 2024
@yhmtsai yhmtsai force-pushed the clang_cl branch 6 times, most recently from 083b66d to 9e53640 Compare November 14, 2024 21:37
@yhmtsai yhmtsai added 1:ST:ready-for-review This PR is ready for review and removed 1:ST:WIP This PR is a work in progress. Not ready for review. labels Nov 15, 2024
@yhmtsai yhmtsai added this to the Ginkgo 1.9.0 milestone Nov 15, 2024
@yhmtsai
Copy link
Member Author

yhmtsai commented Nov 18, 2024

I found the const-ness issue by lucky. I do not have an idea that any tool can help detecting this situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-for-review This PR is ready for review mod:all This touches all Ginkgo modules. plat:windows This is related to the Windows Operating system reg:benchmarking This is related to benchmarking. reg:ci-cd This is related to the continuous integration system. reg:testing This is related to testing. type:matrix-format This is related to the Matrix formats type:multigrid This is related to multigrid type:preconditioner This is related to the preconditioners type:reordering This is related to the matrix(LinOp) reordering type:solver This is related to the solvers type:stopping-criteria This is related to the stopping criteria
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants